<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr = [
			{ id: 1, name: "项羽" },
			{ id: 2, name: "剑圣" },
			{ id: 3, name: "盲僧" },
			{ id: 4, name: "末日使者" },
			{ id: 2, name: "兽王" }
		]; 
        // findIndex() 找到第一个符合条件的元素的索引值，如果没有 返回-1
        // return true, 表示查找结束，循环不在继续，返回元素的index

        let rusult=arr.findIndex((item,index)=>{
            console.log(item,index);
            if(item.id>3){
                return true
            }
        })
        console.log(rusult);
    </script>
</body>
</html>